<template>
  <div class="hm-button">hm-button {{ count }}</div>
  <button @click="emit('onAdd', 9)">++</button>
  <button @click="emit('onDes', 9)">--</button>
</template>

<script lang="ts" setup>
interface Emits {
  (e: 'onAdd', num: number): void
  (e: 'onDes', num: number): void
}
const emit = defineEmits<Emits>()
// 用defineProps接受父传子的属性
interface Props {
  count: number
}
defineProps<Props>()
const validate = () => {
  alert('validate')
}
// 用defineExpose暴露方法
defineExpose({
  validate
})
</script>

<style lang="scss" scoped>

</style>